<?php
/**
 * @category   Application_Extensions
 * @package    Talktangle Plugin 
 * @copyright  Idragon Co., Ltd.
 * @license
 */
class Talktangle_Widget_FollowerstangleController extends Engine_Content_Widget_Abstract {
		
	public function indexAction() {
	   
	    $viwer = Engine_Api::_()->user()->getViewer();
        if(empty($viwer)){
            $this->view->paginator = null; return;
            return $this->setNoRender();
        } 
        $promotionT = Engine_Api::_()->getDbtable('Followers','talktangle');
        $ids = $promotionT->getFollowerIds($viwer->user_id);
        if(empty($ids)){
            $this->view->total = -1;
            $this->view->paginator = null;
            return;
        }
        $userT = Engine_Api::_()->getDbtable('users','user');
        $select  = $userT->select()->where('user_id in (?)',$ids);
       
        $this->view->paginator = $paginator = Zend_Paginator::factory($select);

        // Set item count per page and current page number
        $paginator->setItemCountPerPage($this->_getParam('itemCountPerPage', 4));
        $paginator->setCurrentPageNumber($this->_getParam('page', 1));
        $this->view->paginator = $paginator;
     
       
	}
}